<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Yaf_Application class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="yaf.appconfig.html">« 应用配置</a></li>
      <li style="float: right;"><a href="yaf-application.app.html">Yaf_Application::app »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.yaf.html">Yaf</a></li>
    <li>The Yaf_Application class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.yaf-application" class="reference">

 <h1 class="title">The Yaf_Application class</h1>
 
 

 <div class="partintro"><p class="verinfo">(No version information available, might only be in Git)</p>


  <div class="section" id="yaf-application.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    <span class="classname"><a href="class.yaf-application.html" class="classname">Yaf_Application</a></span>为应用提供了一个辅助设施。
    它提供了可重用的资源，常见的和模块化的引导类，还有依赖的检查。
   </p>
   <p class="para">
    <blockquote class="note"><p><strong class="note">注意</strong>: 
     <p class="para">
       <span class="classname"><a href="class.yaf-application.html" class="classname">Yaf_Application</a></span>实现了单例模式。
       <span class="classname"><a href="class.yaf-application.html" class="classname">Yaf_Application</a></span>不能够被序列化和反序列化，
       因为当你尝试使用PHPUnit来为Yaf写一些测试用例的时候会造成一些不必要的麻烦。
      </p>
      <p class="para">
        你可以使用PHPUnit的@backupGlobals注释来控制全局变量的备份和恢复操作，
        从而可以解决这个问题。
     </p>
    </p></blockquote>
   </p>
  </div>


  <div class="section" id="yaf-application.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">final</span>
      <span class="modifier">class</span> <a href="class.yaf-application.html" class="classname">Yaf_Application</a>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">protected</span>
      <var class="varname"><a href="class.yaf-application.html#yaf-application.props.config">$<var class="varname">config</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">protected</span>
      <var class="varname"><a href="class.yaf-application.html#yaf-application.props.dispatcher">$<var class="varname">dispatcher</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">protected</span>
     <span class="modifier">static</span>
      <var class="varname"><a href="class.yaf-application.html#yaf-application.props.app">$<var class="varname">_app</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">protected</span>
      <var class="varname"><a href="class.yaf-application.html#yaf-application.props.modules">$<var class="varname">_modules</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">protected</span>
      <var class="varname"><a href="class.yaf-application.html#yaf-application.props.running">$<var class="varname">_running</var></a></var>;</div>

    <div class="fieldsynopsis"><span class="modifier">protected</span>
      <var class="varname"><a href="class.yaf-application.html#yaf-application.props.environ">$<var class="varname">_environ</var></a></var>;</div>


    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><a href="yaf-application.app.html" class="methodname">app</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.bootstrap.html" class="methodname">bootstrap</a></span>(<span class="methodparam"><span class="type"><a href="class.yaf-bootstrap-abstract.html" class="type Yaf_Bootstrap_Abstract">Yaf_Bootstrap_Abstract</a></span> <code class="parameter">$bootstrap</code><span class="initializer"> = ?</span></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.clearlasterror.html" class="methodname">clearLastError</a></span>(): <span class="type"><a href="class.yaf-application.html" class="type Yaf_Application">Yaf_Application</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span><span class="methodname"><a href="yaf-application.construct.html" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$config</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$envrion</code><span class="initializer"> = ?</span></span>)</div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.destruct.html" class="methodname">__destruct</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.environ.html" class="methodname">environ</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.execute.html" class="methodname">execute</a></span>(<span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$entry</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$...</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.getappdirectory.html" class="methodname">getAppDirectory</a></span>(): <span class="type"><a href="class.yaf-application.html" class="type Yaf_Application">Yaf_Application</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.getconfig.html" class="methodname">getConfig</a></span>(): <span class="type"><a href="class.yaf-config-abstract.html" class="type Yaf_Config_Abstract">Yaf_Config_Abstract</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.getdispatcher.html" class="methodname">getDispatcher</a></span>(): <span class="type"><a href="class.yaf-dispatcher.html" class="type Yaf_Dispatcher">Yaf_Dispatcher</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.getlasterrormsg.html" class="methodname">getLastErrorMsg</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.getlasterrorno.html" class="methodname">getLastErrorNo</a></span>(): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.getmodules.html" class="methodname">getModules</a></span>(): <span class="type">array</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.run.html" class="methodname">run</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="yaf-application.setappdirectory.html" class="methodname">setAppDirectory</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$directory</code></span>): <span class="type"><a href="class.yaf-application.html" class="type Yaf_Application">Yaf_Application</a></span></div>

   }</div>


  </div>

  

  <div class="section" id="yaf-application.props">
   <h2 class="title">属性</h2>
   <dl>
    
     <dt id="yaf-application.props.config"><var class="varname">config</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
     <dt id="yaf-application.props.dispatcher"><var class="varname">dispatcher</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
     <dt id="yaf-application.props.app"><var class="varname">_app</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
     <dt id="yaf-application.props.modules"><var class="varname">_modules</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
     <dt id="yaf-application.props.running"><var class="varname">_running</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
    
     <dt id="yaf-application.props.environ"><var class="varname">_environ</var></dt>

     <dd>

      <p class="para"/>
     </dd>

    
   </dl>

  </div>



 </div>

 










































































































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="yaf-application.app.html">Yaf_Application::app</a> — 获取当前的Yaf_Application实例</li><li><a href="yaf-application.bootstrap.html">Yaf_Application::bootstrap</a> — 调用bootstrap</li><li><a href="yaf-application.clearlasterror.html">Yaf_Application::clearLastError</a> — 清除最后的错误信息</li><li><a href="yaf-application.construct.html">Yaf_Application::__construct</a> — Yaf_Application的构造函数</li><li><a href="yaf-application.destruct.html">Yaf_Application::__destruct</a> — 析构函数</li><li><a href="yaf-application.environ.html">Yaf_Application::environ</a> — 获取当前Yaf_Application的环境名</li><li><a href="yaf-application.execute.html">Yaf_Application::execute</a> — 运行回调函数</li><li><a href="yaf-application.getappdirectory.html">Yaf_Application::getAppDirectory</a> — 获取应用的目录</li><li><a href="yaf-application.getconfig.html">Yaf_Application::getConfig</a> — 获取 Yaf_Config_Abstract 的实例</li><li><a href="yaf-application.getdispatcher.html">Yaf_Application::getDispatcher</a> — 获取 Yaf_Dispatcher 的实例</li><li><a href="yaf-application.getlasterrormsg.html">Yaf_Application::getLastErrorMsg</a> — 获取最近产生的错误的错误信息</li><li><a href="yaf-application.getlasterrorno.html">Yaf_Application::getLastErrorNo</a> — 获取最后产生的错误的错误代码</li><li><a href="yaf-application.getmodules.html">Yaf_Application::getModules</a> — 获取在配置文件中申明的模块</li><li><a href="yaf-application.run.html">Yaf_Application::run</a> — 运行 Yaf_Application</li><li><a href="yaf-application.setappdirectory.html">Yaf_Application::setAppDirectory</a> — 改变应用目录</li></ul>
</div>
</div></div></body></html>